import React from 'react';
import CommonList from '../../../../components/CommonLists/list';
import { Button } from 'antd';
import Modal from '../../../../components/Modal/index';
import Publish from '../../../Strategy/Strategy/publish'

class ProduceList extends CommonList {
  constructor(props) {
    super(props);
    this.api = 'produce';
    this.tableClass = '';
    this.delButton = false;
    this.tableParams = {
      rowKey: 'strategy_id'
    };
    this.publishButton = (record, index) => {
      return (
        <Button size='small' type='link' onClick={this.openPublish.bind(this, record)} disabled={(index > 4 || record.status === -2)}>
          重新发布
        </Button>
      );
    };

    this.btnGroup = [this.publishButton];
  }
  componentDidMount() {}

  closeModel = () => {
    Modal.close()
  }

  // 策略发布
  openPublish = (record) => {
    Modal.open({
      title: '策略发布',
      width: '600px',
      content: <Publish record={record} type='reissue' closeModel={this.closeModel} />,
      isOkBtn: false,
      isCancelBtn: false,
    });
  }
}

export default ProduceList;
